<?php
/*
 *  A Part of snock project
 *   Author king-of-war
 * Last modified 2009-4-22
 *
 */
 @session_start();
 $root_path='../';
 include_once $root_path . 'admin/smarty_config.php';
include_once $root_path . 'admin/class/fun_common.php';
include_once $root_path . 'admin/class/flink.class.php';
include_once $root_path . 'admin/class/cfg.class.php';

/*
 *
 * check identify
 */
include_once $root_path.'admin/class/verify.class.php';
$a=new verify($root_path);
$a->identity_check(3);

$cfg=new cfg($root_path);
  $page_size=$cfg->xml_read('page_num');
$flink=new flink($root_path);
$fun = new fun_common($root_path);

$max = $fun->getAll('flinks', 1);
/*
 * page moudle start
 *
 */
if (!empty ($_GET['p'])) {
	$page = $_GET['p'];
} else {
	$page = 1;
}
$pages = $fun->page($page, $page_size, $max);
/*
 * page moulde  end
 *
 *  sort_read($arr)
 */
$arr[0] = $pages['start'];
$arr[1] =  $page_size;
/*
 * get the comment of sorts
 */
$links=array();

$pass=$flink->flink_get($arr,1);



for($i=0;$i<count($pass);$i++){
	$links[$i]['id']=$pass[$i]->get_id();
   $links[$i]['name']=$pass[$i]->get_name();
$links[$i]['image']=$pass[$i]->get_images();
  $links[$i]['introduction']=$pass[$i]->get_introduction();
  	$links[$i]['url']=$pass[$i]->get_url();
	$links[$i]['verify']=$pass[$i]->get_verify();

}


/*
 * sort delete moudle
 */

if (isset($_POST['Submit'])) {

//	$ids = array ();
		$t=0;
	for ($i = 0; $i < $max; $i++) {

		$id = $links[$i]['id'];

		if ($_POST[$id]!= '') {

			$ids[$t]=$id;
			$t++;
		}

	}



	 $line=$flink->flink_del($ids);

if($line){
	echo '<div align="center"><h1>成功删除'.$line.'条产品</h1></div>';
}else{
	echo '<div align="center"><h1>删除失败</h1></div>';
};
}

$smarty->assign("flink", $links);
$smarty->assign("page", $pages);
$smarty->assign("url", $root_path);
$smarty->display("flink_del.html");

?>


